home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / CODE / Chap13 / Wanderer / MainFrame.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  1.8 KB  |  72 lines

  1. //***********************************************************************
  2. //
  3. //  MainFrame.cpp
  4. //
  5. //***********************************************************************
  6.  
  7. #include <afxwin.h>
  8. #include <afxext.h>
  9. #include <afxcview.h>
  10. #include "Resource.h"
  11. #include "MainFrame.h"
  12. #include "WandDoc.h"
  13. #include "DriveView.h"
  14. #include "FileView.h"
  15.  
  16. IMPLEMENT_DYNCREATE (CMainFrame, CFrameWnd)
  17.  
  18. BEGIN_MESSAGE_MAP (CMainFrame, CFrameWnd)
  19.     ON_WM_CREATE ()
  20. END_MESSAGE_MAP ()
  21.  
  22. BOOL CMainFrame::PreCreateWindow (CREATESTRUCT& cs)
  23. {
  24.     if (!CFrameWnd::PreCreateWindow (cs))
  25.         return FALSE;
  26.  
  27.     cs.style &= ~FWS_ADDTOTITLE;
  28.     return TRUE;
  29. }
  30.  
  31. int CMainFrame::OnCreate (LPCREATESTRUCT lpcs)
  32. {
  33.     if (CFrameWnd::OnCreate (lpcs) == -1)
  34.         return -1;
  35.  
  36.     m_wndStatusBar.Create (this);
  37.     UINT nIndicator = ID_SEPARATOR;
  38.     m_wndStatusBar.SetIndicators (&nIndicator, 1);
  39.     return 0;
  40. }
  41.  
  42. BOOL CMainFrame::OnCreateClient (LPCREATESTRUCT lpcs,
  43.     CCreateContext* pContext)
  44. {
  45.     if (!m_wndSplitter.CreateStatic (this, 1, 2) ||
  46.         !m_wndSplitter.CreateView (0, 1, RUNTIME_CLASS (CFileView),
  47.             CSize (0, 0), pContext) ||
  48.         !m_wndSplitter.CreateView (0, 0, RUNTIME_CLASS (CDriveView),
  49.             CSize (192, 0), pContext))
  50.         return FALSE;
  51.  
  52.     return TRUE;
  53. }
  54.  
  55. BOOL CMainFrame::OnCmdMsg (UINT nID, int nCode, void* pExtra,
  56.     AFX_CMDHANDLERINFO* pHandlerInfo)
  57. {
  58.     // Route to standard command targets first
  59.     if (CFrameWnd::OnCmdMsg (nID, nCode, pExtra, pHandlerInfo))
  60.         return TRUE;
  61.  
  62.     // Route to inactive views second
  63.     CWandDoc* pDoc = (CWandDoc*) GetActiveDocument ();
  64.     if (pDoc != NULL) {
  65.         if (pDoc->RouteCmdToAllViews (GetActiveView (), nID, nCode,
  66.             pExtra, pHandlerInfo))
  67.             return TRUE;
  68.     }
  69.  
  70.     return FALSE;
  71. }
  72.